<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>box1</title>
	<style type="text/css">
	.box{
		width: 200px;
		height: 200px;
		background: red url() 0 0 no-repeat;
	}
	</style>
</head>
<body>
	<div class="time" id="time">		

	</div>
	<div class="box" id="box">
		
	</div>


	<script type="text/javascript">
	var box=document.getElementById('box');

//获取实际样式属性，获取宽度数据。	
	// var width = getComputedStyle(box).width;
	// alert(width);
	var width = parseInt(getComputedStyle(box).width);//将获取的数据200px转化成整形数值200，便于计算
	var height = parseInt(getComputedStyle(box).height);

	var c = 0;
	function run () {

			if(width<200){
				c=0;
			}

			if(width>400){
				c=1;
			}


			if(c==0){
				width +=5;
				height +=5;
			}else{
				width -=5;
				height -=5;
			}
			
			box.style.width= width+"px";
			box.style.height= height+"px";


		}


		var time = setInterval(run, 10);


		box.onmouseover = function  (argument) {
			clearInterval(time);
		}


		box.onmouseout = function  (argument) {
			time = setInterval(run, 10);
		}


	</script>
</body>
</html>